﻿using System;
using System.Collections.Generic;

namespace Model
{
    public class OperatorSessionCollection
    {
        public List<OperatorSession> OperatorSessions { get; set; }

        public OperatorSessionCollection()
        {
            OperatorSessions = new List<OperatorSession>();
        }

        #region Methods
        public OperatorSession Add(string initials, DateTime startTime, DateTime endTime)
        {
            OperatorSession ios = new OperatorSession(initials, startTime, endTime);
            OperatorSessions.Add(ios);
            return ios;
        }
        public OperatorSession Edit(string initials, DateTime startTime, DateTime endTime)
        {
            foreach (OperatorSession os in OperatorSessions)
            {
                if (os.Initials == initials && os.StartTime == startTime)
                {
                    os.EndTime = endTime;
                    return os;
                }
            }
            return null;
        }
        public List<OperatorSession> GetOperatorSessionList()
        {
            return OperatorSessions;
        }
        #endregion
    }
}